home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume17 / zoo2 / part01 next >
Encoding:
Internet Message Format  |  1989-02-01  |  47.1 KB

  1. Subject:  v17i064:  Zoo archive program, Part01/10
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Rahul Dhesi <bsu-cs!dhesi@iuvax.cs.indiana.edu>
  6. Posting-number: Volume 17, Issue 64
  7. Archive-name: zoo2/part01
  8.  
  9. The zoo archive program maintains archives of files in compressed
  10. form.  Subdirectory structure can be preserved across dissimilar
  11. systems.  Timezone and file attributes can be preserved.  Multiple
  12. generations of the same file can be stored, and the user may specify
  13. how many generations of a file should be kept.  A comment may be
  14. attached to each archived file or to the archive as a whole.  Filenames
  15. to be archived may be fed from standard input or supplied as
  16. arguments.
  17.  
  18. This is a posting of the (relatively) portable C source for version
  19. 2.01.  It is ready for compilation under VAX/VMS 4.6, 4.3BSD, Xenix,
  20. System V Release 2 (including Microport System V/AT), and other similar
  21. systems.  A system-dependent support package, which will allow this
  22. present source posting to be compiled under MS-DOS, will be posted to
  23. comp.binaries.ibm.pc separately.  Binaries for AmigaDOS and MS-DOS,
  24. have appeared or will appear in appropriate newsgroups.  A small,
  25. memory-efficient zoo archive extractor called "booz" has already
  26. appeared in comp.sources.misc.
  27.  
  28. Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi
  29.  
  30. #! /bin/sh
  31. # This is a shell archive.  Remove anything before this line, then unpack
  32. # it by saving it into a file and typing "sh file".  To overwrite existing
  33. # files, type "sh file -c".  You can also feed this as standard input via
  34. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  35. # will see the following message at the end:
  36. #        "End of archive 1 (of 10)."
  37. # Wrapped by rsalz@papaya.bbn.com on Thu Feb  2 18:03:55 1989
  38. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  39. if test -f 'Changes' -a "${1}" != "-c" ; then 
  40.   echo shar: Will not clobber existing file \"'Changes'\"
  41. else
  42. echo shar: Extracting \"'Changes'\" \(2497 characters\)
  43. sed "s/^X//" >'Changes' <<'END_OF_FILE'
  44. X
  45. X
  46. X                                CHANGES
  47. X
  48. X
  49. XSummary of Changes from Zoo version 1.51 to version 2.0.
  50. X
  51. X   - New modifiers to the list commands permit several new output
  52. X     formats.
  53. X
  54. X   - Timezones are handled.
  55. X
  56. X   - A bug was fixed that had made it impossible to individually update
  57. X     comments for a file whose name did not correspond to MS-DOS format.
  58. X
  59. X   - The shared library on the **IX PC can be used.
  60. X
  61. X   - VAX/VMS is now supported reasonably well.
  62. X
  63. X   - A comment may now be attached to the archive itself.
  64. X
  65. X   - Extracted files can optionally be forced to overwrite existing
  66. X     read-only files.
  67. X
  68. X   - Extracted files will not overwrite newer existing files unless
  69. X     specifically requested.
  70. X
  71. X   - File attributes (lowest nine mode bits) are preserved for **IX
  72. X     systems.
  73. X
  74. X   - Multiple generations of the same file are supported.
  75. X
  76. X   - Zoo will now act as a pure compression or uncompression filter on a
  77. X     single input data stream.
  78. X
  79. X   - A bug was fixed that could cause removal of a directory link by the
  80. X     superuser.
  81. X
  82. X   - The ability of Zoo to recover data from damaged archives is greatly
  83. X     improved.
  84. X
  85. X
  86. XSummary of Changes from Zoo version 2.00 to version 2.01.
  87. X
  88. X   - A bug was fixed that had caused the first generation of a file to
  89. X     sometimes unexpectedly show up in archive listings.
  90. X
  91. X   - A bug was fixed that had caused the MS-DOS version to silently skip
  92. X     extracting files for which there was not sufficient disk space; an
  93. X     error message will now be given.
  94. X
  95. X   - A bug was fixed that had sometimes made it impossible to
  96. X     selectively extract a file by specifying its name, even though all
  97. X     files could be extracted from the archive by not specifying any
  98. X     filenames.  This occurred when a file had been archived on a
  99. X     longer-filename system (e.g. AmigaDOS) and extraction was attempted
  100. X     on a shorter-filename system (e.g. MS-DOS).
  101. X
  102. X   - A change was made that will make zoo preserve the mode (file
  103. X     protection) of a zoo archive when it is packed.  This is effective
  104. X     only if zoo is compiled to preserve and restore file attributes.
  105. X     Currently this is so only for **IX systems.
  106. X
  107. X   - A bug was fixed that had caused an update of an archive to not
  108. X     always add all newer files.
  109. X
  110. X   - Blanks around equal signs in commands given to "make" were removed
  111. X     from the mk* scripts for better compatiblity with more **IX
  112. X     implementations including Sun's.
  113. X
  114. X                                     -- Rahul Dhesi 1988/08/25
  115. END_OF_FILE
  116. if test 2497 -ne `wc -c <'Changes'`; then
  117.     echo shar: \"'Changes'\" unpacked with wrong size!
  118. fi
  119. # end of 'Changes'
  120. fi
  121. if test -f 'Latenews' -a "${1}" != "-c" ; then 
  122.   echo shar: Will not clobber existing file \"'Latenews'\"
  123. else
  124. echo shar: Extracting \"'Latenews'\" \(1207 characters\)
  125. sed "s/^X//" >'Latenews' <<'END_OF_FILE'
  126. X                              Late breaking comments
  127. X
  128. Xo    I have not tried compiling and executing all source files with NDEBUG
  129. X     *not* defined.  When NDEBUG is not defined, many assertions in the code
  130. X     get enabled and will give error messages if they fail.  Recent
  131. X     revisions may have made some of these assertions invalid.
  132. X
  133. Xo    On systems with ints longer than 32 bits, there were some minor
  134. X     portability problems reported in the past.  I suggested some fixes (which
  135. X     are incorporated in the current distribution) but was unable to confirm
  136. X     if they worked.  If you get zoo 2.0 working on a Cray, CDC, or similar
  137. X     machine with very large ints, please let me know.
  138. X
  139. Xo    Handling of pathnames longer than 255 characters is probably not robust
  140. X     at this time.  Zoo should be able to handle pathanmes of up to 510
  141. X     characters, with the filename part and the directory prefix part each
  142. X     being 255 characters or less.  But it will probably choke on any pathname
  143. X     that is longer than 255 characters.
  144. X
  145. Xo    The **IX "file" command, at least on System V Release 2 and on 4.3BSD,
  146. X     can be made to recognize zoo archives.  Instructions are in the file
  147. X     "file.fix".
  148. END_OF_FILE
  149. if test 1207 -ne `wc -c <'Latenews'`; then
  150.     echo shar: \"'Latenews'\" unpacked with wrong size!
  151. fi
  152. # end of 'Latenews'
  153. fi
  154. if test -f 'addbfcrc.c' -a "${1}" != "-c" ; then 
  155.   echo shar: Will not clobber existing file \"'addbfcrc.c'\"
  156. else
  157. echo shar: Extracting \"'addbfcrc.c'\" \(852 characters\)
  158. sed "s/^X//" >'addbfcrc.c' <<'END_OF_FILE'
  159. X#ifndef LINT
  160. Xstatic char sccsid[]="@(#) addbfcrc.c 2.2 88/01/29 17:04:31";
  161. X#endif /* LINT */
  162. X
  163. X#include "options.h"
  164. X/*
  165. Xaddbfcrc() accepts a buffer address and a count and adds the CRC for
  166. Xall bytes in the buffer to the global variable crccode using
  167. XCRC-16.
  168. X
  169. XCRC computation algorithm originally from an article by David Schwaderer 
  170. Xin the April 1985 issue of PC Tech Journal.
  171. X
  172. XLoop optimization done by J. Brian Waters.
  173. X
  174. XI claim no copyright over the contents of this file.
  175. X
  176. X                                    -- Rahul Dhesi 1986/08/27
  177. X
  178. X*/
  179. X
  180. Xextern unsigned int crccode;
  181. Xextern unsigned crctab[];
  182. X
  183. Xvoid addbfcrc(buffer,count)
  184. Xregister char *buffer;
  185. Xregister int count;
  186. X
  187. X{
  188. X   register unsigned int localcrc;
  189. X   localcrc = crccode;
  190. X
  191. X   for (; count--; )
  192. X      localcrc = (localcrc>>8) ^ crctab[(localcrc ^ (*buffer++)) & 0x00ff];
  193. X   crccode = localcrc;
  194. X}
  195. END_OF_FILE
  196. if test 852 -ne `wc -c <'addbfcrc.c'`; then
  197.     echo shar: \"'addbfcrc.c'\" unpacked with wrong size!
  198. fi
  199. # end of 'addbfcrc.c'
  200. fi
  201. if test -f 'assert.h' -a "${1}" != "-c" ; then 
  202.   echo shar: Will not clobber existing file \"'assert.h'\"
  203. else
  204. echo shar: Extracting \"'assert.h'\" \(1341 characters\)
  205. sed "s/^X//" >'assert.h' <<'END_OF_FILE'
  206. X/* @(#) assert.h 2.1 87/12/25 12:21:32 */
  207. X
  208. X/*
  209. XThe contents of this file are hereby released to the public domain.
  210. X
  211. X                           -- Rahul Dhesi 1986/11/14
  212. X
  213. XDefines a macro assert() that causes an assertion error if the assertion
  214. Xfails.  For some useful information about this see "Reliable Data
  215. XStructures in C" by Thomas Plum page 1-21.
  216. X
  217. XConditional compilation:
  218. X
  219. X   If NDEBUG is defined then
  220. X      assert() is defined as null so all assertions vanish
  221. X   else
  222. X      if DUMB_ASS is defined then   -- use dumb assertions
  223. X         assertions print a message but not the filename and line number
  224. X      else
  225. X         assertions print message including filename and line number
  226. X      endif
  227. X   endif
  228. X
  229. XNote:
  230. X   DUMB_ASS should be defined if the preprocessor does not support the 
  231. X   varying constants __FILE__ and __LINE__, which are supposed to hold the 
  232. X   name of the current file and the number of the current line.
  233. X
  234. X*/
  235. X
  236. X#ifndef NDEBUG
  237. X/* assert() macro defined only if NDEBUG is undefined */
  238. X#ifdef DUMB_ASS
  239. X#define assert(E) \
  240. X   { if (!(E)) \
  241. X      prterror ('w', "Assertion error.\n"); \
  242. X   }
  243. X#else
  244. X/* else not DUMB_ASS */
  245. X#define assert(E) \
  246. X   { if (!(E)) \
  247. X      prterror ('w',"Assertion error in %s:%d.\n", __FILE__, __LINE__); \
  248. X   }
  249. X#endif /* not DUMB_ASS */
  250. X#else
  251. X/* else NDEBUG */
  252. X#define assert(E)
  253. X#endif /* NDEBUG */
  254. END_OF_FILE
  255. if test 1341 -ne `wc -c <'assert.h'`; then
  256.     echo shar: \"'assert.h'\" unpacked with wrong size!
  257. fi
  258. # end of 'assert.h'
  259. fi
  260. if test -f 'bsd.c' -a "${1}" != "-c" ; then 
  261.   echo shar: Will not clobber existing file \"'bsd.c'\"
  262. else
  263. echo shar: Extracting \"'bsd.c'\" \(2377 characters\)
  264. sed "s/^X//" >'bsd.c' <<'END_OF_FILE'
  265. X#ifndef LINT
  266. Xstatic char bsdid[]="@(#) bsd.c 2.3 88/01/10 14:45:19";
  267. X#endif /* LINT */
  268. X
  269. X/* machine.c for 4.3BSD. */
  270. X
  271. X/*
  272. XThe contents of this file are hereby released to the public domain.
  273. X
  274. X                                    -- Rahul Dhesi  1987/07/23
  275. X*/
  276. X
  277. X/* 
  278. XWARNING:  This file assumes that ZOOFILE is a standard buffered
  279. Xfile.  It will have to be modified if ZOOFILE is changed to
  280. Xbe an unbuffered file descriptor or to any other kind of file.
  281. X*/
  282. X
  283. X#ifdef UNBUF_IO
  284. X/*
  285. XFunction tell() returns the current seek position for a file 
  286. Xdescriptor.  4.3BSD on VAX-11/785 has an undocumented tell() function
  287. Xbut it may not exist on all implementations, so we code one here
  288. Xto be on the safe side.  It is needed for unbuffered I/O only.
  289. X*/
  290. Xlong lseek PARMS ((int, long, int));
  291. Xlong tell (fd)
  292. Xint fd;
  293. X{ return (lseek (fd, 0L, 1)); }
  294. X#endif
  295. X
  296. Xlong ftell();
  297. X
  298. X/****************
  299. XFunction trunc() truncates a file.
  300. X*/
  301. X
  302. Xint trunc (f)
  303. XZOOFILE f;
  304. X{
  305. X    fflush (f);                                    /* just in case it matters */
  306. X   ftruncate (fileno (f), ftell (f));
  307. X}
  308. X
  309. X/****************
  310. XFunction fixfname() converts the supplied filename to a syntax
  311. Xlegal for the host system.  It is used during extraction.
  312. X*/
  313. X
  314. Xchar *fixfname(fname)
  315. Xchar *fname;
  316. X{
  317. X   return (fname); /* default is no-op */
  318. X}
  319. X
  320. X/****************
  321. XDate and time functions are standard UNIX-style functions.  "nixtime.i"
  322. Xwill be included by machine.c.
  323. X*/
  324. X
  325. X#include <sys/types.h>
  326. X#include <sys/stat.h>
  327. X#include <sys/time.h>
  328. X
  329. X/* Function isadir() returns 1 if the supplied handle is a directory, 
  330. Xelse it returns 0.  
  331. X*/
  332. X
  333. Xint isadir (f)
  334. XZOOFILE f;
  335. X{
  336. X   struct stat buf;           /* buffer to hold file information */
  337. X   if (fstat (fileno (f), &buf) == -1) {
  338. X      return (0);             /* inaccessible -- assume not dir */
  339. X   } else {
  340. X      if (buf.st_mode & S_IFDIR)
  341. X         return (1);
  342. X      else
  343. X         return (0);
  344. X   }
  345. X}
  346. X
  347. X/* Function gettz(), returns the offset from GMT in seconds */
  348. Xlong gettz()
  349. X{
  350. X   struct timeval tp;
  351. X   struct timezone tzp;
  352. X   gettimeofday (&tp, &tzp);              /* specific to 4.3BSD */
  353. X
  354. X   /* return (tzp.tz_minuteswest * 60); */ /* old incorrect code */
  355. X    /* Timezone fix thanks to Bill Davidsen <wedu@ge-crd.ARPA> */
  356. X   return (tzp.tz_minuteswest * 60 - tzp.tz_dsttime * 3600L);
  357. X}
  358. X
  359. X/* Standard UNIX-compatible time routines */
  360. X#include "nixtime.i"
  361. X
  362. X/* Standard UNIX-specific file attribute routines */
  363. X#include "nixmode.i"
  364. END_OF_FILE
  365. if test 2377 -ne `wc -c <'bsd.c'`; then
  366.     echo shar: \"'bsd.c'\" unpacked with wrong size!
  367. fi
  368. # end of 'bsd.c'
  369. fi
  370. if test -f 'crcdefs.c' -a "${1}" != "-c" ; then 
  371.   echo shar: Will not clobber existing file \"'crcdefs.c'\"
  372. else
  373. echo shar: Extracting \"'crcdefs.c'\" \(2446 characters\)
  374. sed "s/^X//" >'crcdefs.c' <<'END_OF_FILE'
  375. X#ifndef LINT
  376. Xstatic char sccsid[]="@(#) crcdefs.c 2.1 87/12/25 12:21:58";
  377. X#endif /* LINT */
  378. X
  379. X#include "options.h"
  380. X
  381. X/*
  382. XGlobal definitions for CRC calculation.  I claim no copyright over
  383. Xthe contents of this file.
  384. X
  385. X                                  -- Rahul Dhesi 1987/08/27
  386. X*/
  387. X
  388. Xunsigned int crccode;
  389. Xunsigned int crctab[] = {
  390. X   0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241,
  391. X    0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 
  392. X    0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0F00, 0xcFc1, 0xce81, 0x0e40, 
  393. X    0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 
  394. X    0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 
  395. X    0x1e00, 0xdec1, 0xdF81, 0x1F40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 
  396. X    0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 
  397. X    0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 
  398. X    0xF001, 0x30c0, 0x3180, 0xF141, 0x3300, 0xF3c1, 0xF281, 0x3240, 
  399. X   0x3600, 0xF6c1, 0xF781, 0x3740, 0xF501, 0x35c0, 0x3480, 0xF441, 
  400. X    0x3c00, 0xFcc1, 0xFd81, 0x3d40, 0xFF01, 0x3Fc0, 0x3e80, 0xFe41, 
  401. X    0xFa01, 0x3ac0, 0x3b80, 0xFb41, 0x3900, 0xF9c1, 0xF881, 0x3840, 
  402. X    0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 
  403. X    0xee01, 0x2ec0, 0x2F80, 0xeF41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 
  404. X    0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 
  405. X    0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 
  406. X    0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 
  407. X    0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 
  408. X   0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaF01, 0x6Fc0, 0x6e80, 0xae41, 
  409. X    0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 
  410. X    0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 
  411. X    0xbe01, 0x7ec0, 0x7F80, 0xbF41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 
  412. X    0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 
  413. X    0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 
  414. X    0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 
  415. X    0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 
  416. X    0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5F00, 0x9Fc1, 0x9e81, 0x5e40, 
  417. X   0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 
  418. X    0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 
  419. X    0x4e00, 0x8ec1, 0x8F81, 0x4F40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 
  420. X    0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 
  421. X    0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 
  422. X};
  423. END_OF_FILE
  424. if test 2446 -ne `wc -c <'crcdefs.c'`; then
  425.     echo shar: \"'crcdefs.c'\" unpacked with wrong size!
  426. fi
  427. # end of 'crcdefs.c'
  428. fi
  429. if test -f 'debug.h' -a "${1}" != "-c" ; then 
  430.   echo shar: Will not clobber existing file \"'debug.h'\"
  431. else
  432. echo shar: Extracting \"'debug.h'\" \(615 characters\)
  433. sed "s/^X//" >'debug.h' <<'END_OF_FILE'
  434. X/* @(#) debug.h 2.1 87/12/25 12:22:02 */
  435. X
  436. X/* 
  437. XThe contents of this file are hereby released to the public domain.
  438. X
  439. X                           -- Rahul Dhesi 1986/11/14
  440. X
  441. Xdefines conditional function calls 
  442. X
  443. XUsage:  The statement
  444. X
  445. X   debug((printf("y = %d\n", y)))
  446. X
  447. Xmay be placed anywhere where two or more statements could be used.  It will 
  448. Xprint the value of y at that point.
  449. X
  450. XConditional compilation:
  451. X
  452. X   if DEBUG is defined
  453. X      define the macro debug(X) to execute statement X
  454. X   else
  455. X      define the macro debug(X) to be null
  456. X   endif
  457. X*/
  458. X
  459. X#ifdef DEBUG
  460. X#define  debug(x)    x;
  461. X#else
  462. X#define  debug(x)
  463. X#endif
  464. X
  465. END_OF_FILE
  466. if test 615 -ne `wc -c <'debug.h'`; then
  467.     echo shar: \"'debug.h'\" unpacked with wrong size!
  468. fi
  469. # end of 'debug.h'
  470. fi
  471. if test -f 'descrip.mms' -a "${1}" != "-c" ; then 
  472.   echo shar: Will not clobber existing file \"'descrip.mms'\"
  473. else
  474. echo shar: Extracting \"'descrip.mms'\" \(2248 characters\)
  475. sed "s/^X//" >'descrip.mms' <<'END_OF_FILE'
  476. X# @(#) descrip.mms 2.2 88/01/09 12:10:49
  477. X#Make Zoo for VAX/VMS
  478. X#
  479. X#The contents of this makefile are hereby released to the public domain.
  480. X#                                  -- Rahul Dhesi 1987/07/23
  481. X
  482. XCC = cc
  483. Xcswitch =
  484. Xextra = /define=(BIG_MEM,NDEBUG,VMS)
  485. Xldswitch =
  486. X
  487. X#List of all object files created for Zoo
  488. XZOOOBJS = addbfcrc.obj, addfname.obj, basename.obj, comment.obj, -
  489. X crcdefs.obj, getfile.obj, lzc.obj, lzd.obj, machine.obj, -
  490. X makelist.obj, misc.obj, misc2.obj, nextfile.obj, -
  491. X needed.obj, options.obj, parse.obj, portable.obj, prterror.obj, -
  492. X version.obj, zoo.obj, zooadd.obj, zooadd2.obj, zoodel.obj, -
  493. X zooext.obj, zoolist.obj, zoopack.obj
  494. X
  495. XFIZOBJS = fiz.obj, addbfcrc.obj, portable.obj, crcdefs.obj
  496. X
  497. X.c.obj :
  498. X    $(CC) $(cswitch) $(extra) $*.c
  499. X
  500. Xzoo.exe : $(ZOOOBJS)
  501. X    link/executable=zoo.exe $(ldswitch) $(ZOOOBJS), options/opt
  502. X
  503. X#bigger but more portable across machines -- no shared libraries
  504. Xzoobig.exe : $(ZOOOBJS)
  505. X    link/executable=zoobig.exe $(ldswitch) $(ZOOOBJS)
  506. X
  507. Xfiz : $(FIZOBJS)
  508. X    link/executable=fiz.exe $(ldswitch) $(FIZOBJS), options/opt
  509. X
  510. Xlzd.obj : lzd.c zoomem.h
  511. X    $(CC) $(cswitch) $(extra) $*.c
  512. X
  513. Xlzc.obj : lzc.c zoomem.h
  514. X    $(CC) $(cswitch) $(extra) $*.c
  515. X
  516. Xaddbfcrc.obj : addbfcrc.c
  517. X
  518. Xaddfname.obj : addfname.c
  519. X
  520. Xbasename.obj : basename.c
  521. X
  522. Xcomment.obj : comment.c zooio.h
  523. X    $(CC) $(cswitch) $(extra) $*.c
  524. X
  525. Xcrcdefs.obj : crcdefs.c
  526. X
  527. Xgetfile.obj : getfile.c zoomem.h
  528. X    $(CC) $(cswitch) $(extra) $*.c
  529. X
  530. Xmachine.obj : machine.c nixtime.i vms.c
  531. X    $(CC) $(cswitch) $(extra) $*.c
  532. X
  533. Xmakelist.obj : makelist.c
  534. X
  535. Xmisc.obj : misc.c zooio.h
  536. X    $(CC) $(cswitch) $(extra) $*.c
  537. X
  538. Xmisc2.obj : misc2.c zoomem.h
  539. X    $(CC) $(cswitch) $(extra) $*.c
  540. X
  541. Xoptions.obj : options.c
  542. X
  543. Xnextfile.obj :  nextfile.c
  544. X
  545. Xneeded.obj : needed.c
  546. X
  547. Xparse.obj : parse.c
  548. X
  549. Xportable.obj : portable.c
  550. X
  551. Xprterror.obj : prterror.c
  552. X
  553. Xzoo.obj :   zoo.c zoomem.h errors.i
  554. X    $(CC) $(cswitch) $(extra) $*.c
  555. X
  556. Xzooadd.obj : zooio.h zooadd.c
  557. X    $(CC) $(cswitch) $(extra) $*.c
  558. X
  559. Xzooadd2.obj : zooio.h zooadd2.c
  560. X    $(CC) $(cswitch) $(extra) $*.c
  561. X
  562. Xzoodel.obj : zooio.h zoodel.c
  563. X    $(CC) $(cswitch) $(extra) $*.c
  564. X
  565. Xzooext.obj : zooext.c  errors.i zooio.h
  566. X    $(CC) $(cswitch) $(extra) $*.c
  567. X
  568. Xzoolist.obj : zooio.h zoolist.c
  569. X    $(CC) $(cswitch) $(extra) $*.c
  570. X
  571. Xzoopack.obj : zooio.h zoopack.c
  572. X    $(CC) $(cswitch) $(extra) $*.c
  573. END_OF_FILE
  574. if test 2248 -ne `wc -c <'descrip.mms'`; then
  575.     echo shar: \"'descrip.mms'\" unpacked with wrong size!
  576. fi
  577. # end of 'descrip.mms'
  578. fi
  579. if test -f 'errors.i' -a "${1}" != "-c" ; then 
  580.   echo shar: Will not clobber existing file \"'errors.i'\"
  581. else
  582. echo shar: Extracting \"'errors.i'\" \(825 characters\)
  583. sed "s/^X//" >'errors.i' <<'END_OF_FILE'
  584. X/* @(#) errors.i 2.4 88/01/31 12:32:46 */
  585. X
  586. X/*
  587. XThe contents of this file are hereby released to the public domain.
  588. X
  589. X                           -- Rahul Dhesi 1986/11/14
  590. X*/
  591. X
  592. X/* defines all the errors as externs.  Declarations must be
  593. Xequivalent to those in prterror.c */
  594. X
  595. X/* These declarations must be equivalent to those in prterror.c */
  596. Xextern char no_match[];
  597. Xextern char failed_consistency[];
  598. Xextern char invalid_header[];
  599. Xextern char internal_error[];
  600. Xextern char disk_full[];
  601. Xextern char bad_directory[];
  602. Xextern char no_memory[];
  603. Xextern char too_many_files[];
  604. Xextern char packfirst[];
  605. Xextern char garbled[];
  606. Xextern char start_ofs[];
  607. X
  608. X#ifndef OOZ
  609. Xextern char wrong_version[];
  610. Xextern char cant_process[];
  611. Xextern char option_ignored[];
  612. Xextern char inv_option[];
  613. Xextern char bad_crc[];
  614. X#endif
  615. X
  616. Xextern char could_not_open[];
  617. X
  618. END_OF_FILE
  619. if test 825 -ne `wc -c <'errors.i'`; then
  620.     echo shar: \"'errors.i'\" unpacked with wrong size!
  621. fi
  622. # end of 'errors.i'
  623. fi
  624. if test -f 'file.fix' -a "${1}" != "-c" ; then 
  625.   echo shar: Will not clobber existing file \"'file.fix'\"
  626. else
  627. echo shar: Extracting \"'file.fix'\" \(1814 characters\)
  628. sed "s/^X//" >'file.fix' <<'END_OF_FILE'
  629. X          Making the "file" command recognize zoo archives
  630. X
  631. XZoo archives have the following magic number:  Beginning at offset 20
  632. Xdecimal, there are four bytes with the values 0xdc, 0xa7, 0xc4, and
  633. X0xfd.  (But if you call the first byte of a zoo archive byte 1, then
  634. Xthe magic bytes will be bytes 21 through 24.)
  635. X
  636. XTo make the "file" command identify zoo archives, changes can be made
  637. Xas follows.
  638. X
  639. X4.3BSD:  See the context diff near the end of this document, suitable
  640. Xfor application with the "patch" utility, that works with the 4.3BSD 
  641. X"file" command on a VAX-11/785.  I don't know if this will also work 
  642. Xunder 4.2BSD or with any other implementation of the "file" command 
  643. Xor on any other CPU.
  644. X
  645. XSystem V Release 2 (as exemplified by Microport System V/AT):  At the
  646. Xend of the file "/etc/magic", add the following line:
  647. X
  648. X20    long        0xfdc4a7dc    zoo archive
  649. X
  650. XThis should work on a little-endian machine, in which the long value
  651. X0xfdc4a7dc is stored with the least-significant byte first.  For a big-
  652. Xendian machine, you will probably need to replace it with 0xdca7c4fd.
  653. XThis assumes that long occupies 4 bytes.  If not, use a data type name
  654. Xthat is exactly 4 bytes.
  655. X
  656. X=====
  657. XChanges needed to make the 4.3BSD "file" command recognize zoo
  658. Xarchives.  Known to work on a VAX-11/785.
  659. X
  660. X*** file.c.old    Thu Mar  6 19:34:29 1986
  661. X--- file.c    Sat Feb 21 19:28:52 1987
  662. X***************
  663. X*** 172,181 ****
  664. X--- 172,187 ----
  665. X      case 070707:
  666. X          printf("cpio data\n");
  667. X          return;
  668. X      }
  669. X  
  670. X+     if (buf[20] == (char) 0xdc && buf[21] == (char) 0xa7 && 
  671. X+                     buf[22] == (char) 0xc4 && buf[23] == (char) 0xfd) {
  672. X+         printf ("zoo archive\n");
  673. X+         return;
  674. X+     }
  675. X+ 
  676. X      if (buf[0] == '#' && buf[1] == '!' && shellscript(buf+2, &mbuf))
  677. X          return;
  678. X      if (buf[0] == '\037' && buf[1] == '\235') {
  679. X          if (buf[2]&0x80)
  680. X              printf("block ");
  681. END_OF_FILE
  682. if test 1814 -ne `wc -c <'file.fix'`; then
  683.     echo shar: \"'file.fix'\" unpacked with wrong size!
  684. fi
  685. # end of 'file.fix'
  686. fi
  687. if test -f 'lzconst.h' -a "${1}" != "-c" ; then 
  688.   echo shar: Will not clobber existing file \"'lzconst.h'\"
  689. else
  690. echo shar: Extracting \"'lzconst.h'\" \(574 characters\)
  691. sed "s/^X//" >'lzconst.h' <<'END_OF_FILE'
  692. X/* @(#) lzconst.h 2.1 87/12/25 12:22:30 */
  693. X
  694. X/*
  695. XThe contents of this file are hereby released to the public domain.
  696. X
  697. X                                    -- Rahul Dhesi  1986/12/31
  698. X*/
  699. X
  700. X#define  INBUFSIZ    (IN_BUF_SIZE - 10)   /* avoid obo errors */
  701. X#define  OUTBUFSIZ   (OUT_BUF_SIZE - 10)
  702. X#define  MEMERR      2
  703. X#define  IOERR       1
  704. X#define  MAXBITS     13
  705. X#define  CLEAR       256         /* clear code */
  706. X#define  Z_EOF       257         /* end of file marker */
  707. X#define  FIRST_FREE  258         /* first free code */
  708. X#define  MAXMAX      8192        /* max code + 1 */
  709. END_OF_FILE
  710. if test 574 -ne `wc -c <'lzconst.h'`; then
  711.     echo shar: \"'lzconst.h'\" unpacked with wrong size!
  712. fi
  713. # end of 'lzconst.h'
  714. fi
  715. if test -f 'machine.c' -a "${1}" != "-c" ; then 
  716.   echo shar: Will not clobber existing file \"'machine.c'\"
  717. else
  718. echo shar: Extracting \"'machine.c'\" \(1142 characters\)
  719. sed "s/^X//" >'machine.c' <<'END_OF_FILE'
  720. X#ifndef LINT
  721. X/* @(#) machine.c 2.3 88/01/02 01:21:44 */
  722. Xstatic char sccsid[]="@(#) machine.c 2.3 88/01/02 01:21:44";
  723. X#endif /* LINT */
  724. X
  725. X/*
  726. XThe contents of this file are hereby released to the public domain.
  727. X
  728. X                                    -- Rahul Dhesi  1986/12/31
  729. X*/
  730. X
  731. X#include "options.h"
  732. X#include "zooio.h"
  733. X#include "zoo.h"
  734. X#include "zoofns.h"
  735. X#include "various.h"
  736. X
  737. X#ifdef UNBUF_IO
  738. Xint write PARMS ((int, VOIDPTR, unsigned));
  739. X
  740. X/*
  741. Xblockwrite() is like write() except that it ignores all
  742. Xoutput to file descriptor -2, which stands for the null file.
  743. X*/
  744. Xint blockwrite (fd, buf, count)
  745. Xint fd;
  746. X#ifdef VOIDPTR
  747. XVOIDPTR buf;
  748. X#else
  749. Xchar *buf;
  750. X#endif /* VOIDPTR */
  751. Xunsigned count;
  752. X{
  753. X    if (fd == -2)
  754. X        return (count);
  755. X    else
  756. X        return (write (fd, buf, count));
  757. X}
  758. X#endif
  759. X
  760. X#ifdef SYS_V
  761. X#include "sysv.c"
  762. X#endif
  763. X
  764. X#ifdef GENERIC
  765. X#include "generic.c"
  766. X#endif
  767. X
  768. X#ifdef BSD4_3
  769. X#include "bsd.c"
  770. X#endif
  771. X
  772. X#ifdef DLC
  773. X#include "generic.c"
  774. X#endif
  775. X
  776. X#ifdef VMS
  777. X#include "vms.c"
  778. X#endif
  779. X
  780. X#ifdef MSC
  781. X#ifdef PORTABLE
  782. X#include "generic.c"
  783. X#else
  784. X#include "msc.c"
  785. X#endif
  786. X#endif
  787. X
  788. X#ifdef TURBOC
  789. X#ifdef PORTABLE
  790. X#include "generic.c"
  791. X#else
  792. X#include "turboc.c"
  793. X#endif
  794. X#endif
  795. END_OF_FILE
  796. if test 1142 -ne `wc -c <'machine.c'`; then
  797.     echo shar: \"'machine.c'\" unpacked with wrong size!
  798. fi
  799. # end of 'machine.c'
  800. fi
  801. if test -f 'machine.h' -a "${1}" != "-c" ; then 
  802.   echo shar: Will not clobber existing file \"'machine.h'\"
  803. else
  804. echo shar: Extracting \"'machine.h'\" \(1069 characters\)
  805. sed "s/^X//" >'machine.h' <<'END_OF_FILE'
  806. X/* @(#) machine.h 2.1 87/12/25 12:22:43 */
  807. X
  808. X/*
  809. XThe contents of this file are hereby released to the public domain.
  810. X
  811. X                           -- Rahul Dhesi 1986/11/14
  812. X*/
  813. X
  814. X/* 
  815. XThis file holds definitions that usually do not change
  816. Xbetween different systems, except when using REALLY strange systems.  But
  817. Xoptions.h and machine.c hold stuff that does change quite a bit.
  818. X*/
  819. X
  820. X/* 
  821. XMAXLONG is the maximum size of a long integer.  Right now it doesn't have to
  822. Xbe accurate since it's only used within zooext() to fake infinite disk space.
  823. X*/
  824. X#define  MAXLONG  ((unsigned long) (~0L))
  825. X
  826. X/* 
  827. XType BYTE must hold exactly 8 bits.  The code will collapse badly if BYTE is
  828. Xanything other than exactly 8 bits. To avoid sign extension when casting
  829. XBYTE to a longer size, it must be declared unsigned.  For machine-
  830. Xindependence, Zoo does all I/O of archive headers and directory entries 
  831. Xin units of BYTE.  The actual file data are not written in units of
  832. XBYTE, however, so portability may not be absolute.
  833. X*/
  834. Xtypedef  unsigned char BYTE;  /* type corresponding to an 8-bit byte */
  835. X
  836. END_OF_FILE
  837. if test 1069 -ne `wc -c <'machine.h'`; then
  838.     echo shar: \"'machine.h'\" unpacked with wrong size!
  839. fi
  840. # end of 'machine.h'
  841. fi
  842. if test -f 'mkbsd' -a "${1}" != "-c" ; then 
  843.   echo shar: Will not clobber existing file \"'mkbsd'\"
  844. else
  845. echo shar: Extracting \"'mkbsd'\" \(167 characters\)
  846. sed "s/^X//" >'mkbsd' <<'END_OF_FILE'
  847. X# @(#) mkbsd 2.2 88/08/15 15:41:34
  848. X#4.3BSD -- make Zoo and Fiz
  849. Xmake "cswitch=-c -O -DBSD4_3" "ldswitch=-o zoo" zoo
  850. Xmake "cswitch=-c -O -DBSD4_3" "ldswitch=-o fiz" fiz
  851. END_OF_FILE
  852. if test 167 -ne `wc -c <'mkbsd'`; then
  853.     echo shar: \"'mkbsd'\" unpacked with wrong size!
  854. fi
  855. # end of 'mkbsd'
  856. fi
  857. if test -f 'mksysv' -a "${1}" != "-c" ; then 
  858.   echo shar: Will not clobber existing file \"'mksysv'\"
  859. else
  860. echo shar: Extracting \"'mksysv'\" \(154 characters\)
  861. sed "s/^X//" >'mksysv' <<'END_OF_FILE'
  862. X# @(#) mksysv 2.1 87/12/25 12:23:16
  863. X#System V
  864. Xmake "cswitch=-c -O -DSYS_V" "ldswitch=-s -o zoo" zoo
  865. Xmake "cswitch=-c -O -DSYS_V" "ldswitch=-s -o fiz" fiz
  866. END_OF_FILE
  867. if test 154 -ne `wc -c <'mksysv'`; then
  868.     echo shar: \"'mksysv'\" unpacked with wrong size!
  869. fi
  870. # end of 'mksysv'
  871. fi
  872. if test -f 'mksysvsh' -a "${1}" != "-c" ; then 
  873.   echo shar: Will not clobber existing file \"'mksysvsh'\"
  874. else
  875. echo shar: Extracting \"'mksysvsh'\" \(355 characters\)
  876. sed "s/^X//" >'mksysvsh' <<'END_OF_FILE'
  877. X# @(#) mksysvsh 2.1 87/12/25 12:23:19
  878. X#This script first calls `mksysvsh' to build zoo and fiz without
  879. X#the shared libraries.  Then it deletes zoo and fiz and reloads
  880. X#them with the shared libraries.
  881. Xsh mksysv
  882. X/bin/rm -f zoo fiz
  883. Xmake CC=ld ldswitch="/lib/crt0s.o /lib/shlib.ifile -o zoo" zoo
  884. Xmake CC=ld ldswitch="/lib/crt0s.o /lib/shlib.ifile -o fiz" fiz
  885. END_OF_FILE
  886. if test 355 -ne `wc -c <'mksysvsh'`; then
  887.     echo shar: \"'mksysvsh'\" unpacked with wrong size!
  888. fi
  889. # end of 'mksysvsh'
  890. fi
  891. if test -f 'mkuport' -a "${1}" != "-c" ; then 
  892.   echo shar: Will not clobber existing file \"'mkuport'\"
  893. else
  894. echo shar: Extracting \"'mkuport'\" \(205 characters\)
  895. sed "s/^X//" >'mkuport' <<'END_OF_FILE'
  896. X# @(#) mkuport 2.3 88/08/15 15:42:39
  897. X#Microport UNIX on AT.  -Ml = large memory model.
  898. Xmake "cswitch=-O -c -Ml -DSYS_V" "ldswitch=-Ml -o zoo" zoo
  899. Xmake "cswitch=-O -c -Ml -DSYS_V" "ldswitch=-Ml -o fiz" fiz
  900. END_OF_FILE
  901. if test 205 -ne `wc -c <'mkuport'`; then
  902.     echo shar: \"'mkuport'\" unpacked with wrong size!
  903. fi
  904. # end of 'mkuport'
  905. fi
  906. if test -f 'mkx68' -a "${1}" != "-c" ; then 
  907.   echo shar: Will not clobber existing file \"'mkx68'\"
  908. else
  909. echo shar: Extracting \"'mkx68'\" \(393 characters\)
  910. sed "s/^X//" >'mkx68' <<'END_OF_FILE'
  911. X# @(#) mkx68 2.1 87/12/25 12:23:27
  912. X#Radio Shack Model 16 with Xenix/68000 3.01.01. "-DM_VOID" tells not 
  913. X#to try to do a typedef of `void'. "-Dvoid=int" because compiler doesn't 
  914. X#know about `void'.  `-s -n' strips and makes it shareable.
  915. Xmake "cswitch=-c -O -DSYS_V -DM_VOID -Dvoid=int" "ldswitch=-s -n -o zoo" zoo
  916. Xmake "cswitch=-c -O -DSYS_V -DM_VOID -Dvoid=int" "ldswitch=-s -n -o fiz" fiz
  917. END_OF_FILE
  918. if test 393 -ne `wc -c <'mkx68'`; then
  919.     echo shar: \"'mkx68'\" unpacked with wrong size!
  920. fi
  921. # end of 'mkx68'
  922. fi
  923. if test -f 'mkx86' -a "${1}" != "-c" ; then 
  924.   echo shar: Will not clobber existing file \"'mkx86'\"
  925. else
  926. echo shar: Extracting \"'mkx86'\" \(425 characters\)
  927. sed "s/^X//" >'mkx86' <<'END_OF_FILE'
  928. X# @(#) mkx86 2.1 87/12/25 12:23:30
  929. X# Make Zoo and Fiz
  930. X# This script is believed to work on:
  931. X#    Xenix 3.4 on Greg Laskin's Intel 310/286
  932. X#    SCO Xenix 2.2 on Robert Cliff's AT.
  933. X#`-Ml' for large memory model, `-M2' to generate code for 80286 cpu,
  934. X#`-F 8000' for 0x8000 bytes of stack space
  935. Xmake "cswitch=-c -O -DSYS_V -Ml -M2" "ldswitch=-Ml -o zoo -F 8000" zoo
  936. Xmake "cswitch=-c -O -DSYS_V -Ml -M2" "ldswitch=-Ml -o fiz" fiz
  937. END_OF_FILE
  938. if test 425 -ne `wc -c <'mkx86'`; then
  939.     echo shar: \"'mkx86'\" unpacked with wrong size!
  940. fi
  941. # end of 'mkx86'
  942. fi
  943. if test -f 'nixmode.i' -a "${1}" != "-c" ; then 
  944.   echo shar: Will not clobber existing file \"'nixmode.i'\"
  945. else
  946. echo shar: Extracting \"'nixmode.i'\" \(1127 characters\)
  947. sed "s/^X//" >'nixmode.i' <<'END_OF_FILE'
  948. X#ifndef LINT
  949. X/* @(#) nixmode.i 1.2 88/01/24 12:48:57 */
  950. Xstatic char modeid[]="@(#) nixmode.i 1.2 88/01/24 12:48:57";
  951. X#endif
  952. X
  953. X/*
  954. X(C) Copyright 1988 Rahul Dhesi -- All rights reserved
  955. X
  956. XUNIX-specific routines to get and set file attribute.  These might be 
  957. Xusable on other systems that have the following identical things:
  958. Xfileno(), fstat(), chmod(), sys/types.h and sys/stat.h.
  959. X*/
  960. X
  961. X/*
  962. XGet file attributes.  Currently only the lowest nine of the
  963. X**IX mode bits are used.  Also we return bit 23=0 and bit 22=1,
  964. Xwhich means use portable attribute format, and use attribute
  965. Xvalue instead of using default at extraction time.
  966. X*/
  967. X
  968. Xunsigned long getfattr (f)
  969. XZOOFILE f;
  970. X{
  971. X    int fd;
  972. X   struct stat buf;           /* buffer to hold file information */
  973. X    fd = fileno(f);
  974. X   if (fstat (fd, &buf) == -1)
  975. X      return (NO_FATTR);      /* inaccessible -- no attributes */
  976. X    else
  977. X        return (unsigned long) (buf.st_mode & 0x1ffL) | (1L << 22);
  978. X}
  979. X
  980. X/*
  981. XSet file attributes.  Only the lowest nine bits are used.
  982. X*/
  983. X
  984. Xint setfattr (f, a)
  985. Xchar *f;                            /* filename */
  986. Xunsigned long a;                /* atributes to set */
  987. X{
  988. X    return (chmod (f, (int) (a & 0x1ff)));
  989. X}
  990. END_OF_FILE
  991. if test 1127 -ne `wc -c <'nixmode.i'`; then
  992.     echo shar: \"'nixmode.i'\" unpacked with wrong size!
  993. fi
  994. # end of 'nixmode.i'
  995. fi
  996. if test -f 'options.c' -a "${1}" != "-c" ; then 
  997.   echo shar: Will not clobber existing file \"'options.c'\"
  998. else
  999. echo shar: Extracting \"'options.c'\" \(1874 characters\)
  1000. sed "s/^X//" >'options.c' <<'END_OF_FILE'
  1001. X#ifndef LINT
  1002. Xstatic char sccsid[]="@(#) options.c 2.1 87/12/25 12:23:56";
  1003. X#endif /* LINT */
  1004. X
  1005. X/*
  1006. XCopyright (C) 1986, 1987 Rahul Dhesi -- All rights reserved
  1007. X*/
  1008. X/*
  1009. XHere we define routines specific to only a few systems.  Routines are
  1010. Xselected based on defined symbols.  Routines specific to only one
  1011. Xsystem are in machine.c for the appropriate system.
  1012. X*/
  1013. X
  1014. X#include "options.h"
  1015. X#include "zooio.h"
  1016. X#include "various.h"
  1017. X#include "zoo.h"
  1018. X#include "zoofns.h"
  1019. X#include "errors.i"
  1020. X
  1021. X#ifdef REN_LINK         
  1022. X/* rename using link() followed by unlink() */
  1023. X/* 
  1024. XThe following code assumes that if unlink() returns nonzero, then the
  1025. Xattempt to unlink failed.  If unlink() ever returns nonzero after actually
  1026. Xunlinking the file, then the file being renamed will be lost!!!  Test this 
  1027. Xthoroughly.  It is assumed that link() and unlink() return zero if no
  1028. Xerror else nonzero.
  1029. X*/
  1030. Xint chname (newname, oldname)
  1031. Xchar *newname, *oldname;
  1032. X{
  1033. X   int status;
  1034. X   if (link (oldname, newname) == 0) { /* if we can create new name */
  1035. X      status = unlink (oldname);          /*   unlink old one */
  1036. X      if (status != 0) {                  /*   if unlink of old name failed */
  1037. X         unlink (newname);                /*     cancel new link */
  1038. X         return (-1);                     /*     return error */
  1039. X      } else
  1040. X         return (0);
  1041. X   }
  1042. X   else                    /* couldn't create new link */
  1043. X      return (-1);
  1044. X}
  1045. X#else
  1046. X/* else not REN_LINK */
  1047. X
  1048. Xint chname (newname, oldname)
  1049. Xchar *newname, *oldname;
  1050. X{
  1051. X#ifdef REN_NORM
  1052. X   if (rename(newname, oldname) != 0)     /* normal order */
  1053. X#else
  1054. X   if (rename(oldname, newname) != 0)     /* reverse order */
  1055. X#endif
  1056. X      return (-1);
  1057. X   else
  1058. X      return (0);
  1059. X}
  1060. X#endif /* end of not REN_LINK */
  1061. X
  1062. X/*
  1063. XStandard exit handler;  not used if specific system defines its
  1064. Xown.
  1065. X*/
  1066. X#ifndef SPECEXIT
  1067. Xint zooexit (status)
  1068. Xint status;
  1069. X{
  1070. X    exit (status);
  1071. X}
  1072. X#endif
  1073. END_OF_FILE
  1074. if test 1874 -ne `wc -c <'options.c'`; then
  1075.     echo shar: \"'options.c'\" unpacked with wrong size!
  1076. fi
  1077. # end of 'options.c'
  1078. fi
  1079. if test -f 'options.opt' -a "${1}" != "-c" ; then 
  1080.   echo shar: Will not clobber existing file \"'options.opt'\"
  1081. else
  1082. echo shar: Extracting \"'options.opt'\" \(28 characters\)
  1083. sed "s/^X//" >'options.opt' <<'END_OF_FILE'
  1084. Xsys$share:vaxcrtl.exe/share
  1085. END_OF_FILE
  1086. if test 28 -ne `wc -c <'options.opt'`; then
  1087.     echo shar: \"'options.opt'\" unpacked with wrong size!
  1088. fi
  1089. # end of 'options.opt'
  1090. fi
  1091. if test -f 'parse.h' -a "${1}" != "-c" ; then 
  1092.   echo shar: Will not clobber existing file \"'parse.h'\"
  1093. else
  1094. echo shar: Extracting \"'parse.h'\" \(704 characters\)
  1095. sed "s/^X//" >'parse.h' <<'END_OF_FILE'
  1096. X/* @(#) parse.h 2.1 87/12/25 12:24:15 */
  1097. X
  1098. X/*
  1099. XThe contents of this file are hereby released to the public domain.
  1100. X
  1101. X                           -- Rahul Dhesi 1986/11/14
  1102. X*/
  1103. X
  1104. X/*
  1105. Xdefines structure used in call to parse()
  1106. X*/
  1107. X#define XTRA  2         /* extra space to avoid off-by-one errors */
  1108. X
  1109. X
  1110. Xstruct path_st {
  1111. X   char drive[2+1+XTRA];            /* drive name            */
  1112. X   char dir[PATHSIZE+1+XTRA];       /* path prefix           */
  1113. X   char fname[8+1+XTRA];            /* root name of filename */
  1114. X   char lfname[LFNAMESIZE+1+XTRA];  /* long filename    */
  1115. X   char ext[EXTLEN+1+XTRA];         /* extension        */
  1116. X};
  1117. X
  1118. X#ifdef LINT_ARGS
  1119. Xvoid parse (struct path_st *, char *);
  1120. X#else
  1121. Xvoid parse();
  1122. X#endif
  1123. END_OF_FILE
  1124. if test 704 -ne `wc -c <'parse.h'`; then
  1125.     echo shar: \"'parse.h'\" unpacked with wrong size!
  1126. fi
  1127. # end of 'parse.h'
  1128. fi
  1129. if test -f 'portable.h' -a "${1}" != "-c" ; then 
  1130.   echo shar: Will not clobber existing file \"'portable.h'\"
  1131. else
  1132. echo shar: Extracting \"'portable.h'\" \(2544 characters\)
  1133. sed "s/^X//" >'portable.h' <<'END_OF_FILE'
  1134. X/* @(#) portable.h 2.3 87/12/26 12:25:49 */
  1135. X/* @(#) portable.h 2.4 88/08/24 00:56:43 */
  1136. X
  1137. X/* Definitions for portable I/O
  1138. X
  1139. XThe contents of this file are hereby released to the public domain.
  1140. X
  1141. X                           -- Rahul Dhesi 1986/11/14
  1142. X
  1143. X
  1144. X
  1145. X                       DEFINITIONS IN THIS FILE
  1146. X
  1147. XSymbols:
  1148. X
  1149. XZ_WRITE, Z_READ, and Z_RDWR are the parameters to supply to zooopen()
  1150. Xand to open an existing file for write, read, and read-write 
  1151. Xrespectively.  Z_NEW is the parameter to supply to zoocreate() to
  1152. Xopen an existing file or create a new file for write and read.  The
  1153. Xfile must be opened in binary format, with no newline translation of
  1154. Xany kind.
  1155. X
  1156. XMacros or functions:
  1157. X
  1158. Xzgetc(x) reads a character from ZOOFILE x.
  1159. Xzputchar(c) writes a character c to standard output.
  1160. XMKDIR(x) creates a directory x.
  1161. X*/
  1162. X
  1163. X/* Borland's Turbo C. */
  1164. X#ifdef   TURBOC
  1165. X/* options for zooopen(), zoocreate() */
  1166. X#define  Z_WRITE        "r+b"
  1167. X#define  Z_READ         "rb"
  1168. X#define  Z_RDWR         "r+b"
  1169. X#define    Z_NEW                "w+b"
  1170. X#define    zgetc(x)            getc(x)
  1171. X#define    zputchar(c)        putchar(c)
  1172. X#define  MKDIR(x)       mkdir(x)
  1173. Xint mkdir (char *);
  1174. X#endif
  1175. X
  1176. X/* Microsoft C 3.0 */
  1177. X#ifdef   MSC
  1178. X/* options for zooopen(), zoocreate() */
  1179. X#define  Z_WRITE        "r+b"
  1180. X#define  Z_READ         "rb"
  1181. X#define  Z_RDWR         "r+b"
  1182. X#define    Z_NEW                "w+b"
  1183. X#define    zgetc(x)            getc(x)
  1184. X#define    zputchar(c)        putchar(c)
  1185. X#define  MKDIR(x)       mkdir(x)
  1186. Xint mkdir (char *);
  1187. X#endif
  1188. X
  1189. X#ifdef VMS
  1190. X#define Z_WRITE        "r+"
  1191. X#define Z_READ            "r"
  1192. X#define Z_RDWR            "r+"
  1193. X#define    Z_NEW            "w+b"
  1194. X#define zgetc(x)    getc(x)
  1195. X#define zputchar(c)    putchar(c)
  1196. X#define MKDIR(x)    vmsmkdir (x, 0)
  1197. X#endif
  1198. X
  1199. X/* Datalight C. */
  1200. X#ifdef     DLC
  1201. X#endif
  1202. X
  1203. X
  1204. X#ifdef GENERIC
  1205. X/* **IX I/O, but MKDIR() is a no-operation */
  1206. X#define  NIX_IO      /* standard **IX I/O */
  1207. X#define  MKDIR(x)
  1208. X#endif
  1209. X
  1210. X/* **IX System V release 2.1 */
  1211. X#ifdef   SYS_V
  1212. X#define  NIX_IO      /* standard **IX I/O */
  1213. X#define  MKDIR(x)       mkdir(x) /* define this in sysv.c */
  1214. X#endif
  1215. X
  1216. X/* Xenix */
  1217. X#ifdef   XENIX
  1218. X#define  NIX_IO      /* standard **IX I/O */
  1219. X#endif
  1220. X
  1221. X/* 4.3BSD */
  1222. X#ifdef BSD4_3
  1223. X#define NIX_IO       /* standard **IX I/O */
  1224. X#define  MKDIR(x)       mkdir(x, 0777)
  1225. X#endif
  1226. X
  1227. X/* Amiga */
  1228. X#ifdef MCH_AMIGA
  1229. X#define MKDIR(x)        /* something is needed here */
  1230. X#define NIX_IO
  1231. X#endif
  1232. X
  1233. X/* Standard **IX I/O definitions */
  1234. X#ifdef   NIX_IO
  1235. X/* options for zooopen(), zoocreate() */
  1236. X#define  Z_WRITE        "r+"
  1237. X#define  Z_READ         "r"
  1238. X#define  Z_RDWR         "r+"
  1239. X#define    Z_NEW                "w+"
  1240. X#define    zgetc(x)            getc(x)
  1241. X#define    zputchar(c)        putchar(c)
  1242. X#endif   /* NIX_IO */
  1243. END_OF_FILE
  1244. if test 2544 -ne `wc -c <'portable.h'`; then
  1245.     echo shar: \"'portable.h'\" unpacked with wrong size!
  1246. fi
  1247. # end of 'portable.h'
  1248. fi
  1249. if test -f 'readme.too' -a "${1}" != "-c" ; then 
  1250.   echo shar: Will not clobber existing file \"'readme.too'\"
  1251. else
  1252. echo shar: Extracting \"'readme.too'\" \(716 characters\)
  1253. sed "s/^X//" >'readme.too' <<'END_OF_FILE'
  1254. XThis is an experiment in off-beat job-hunting techniques.
  1255. X
  1256. XWhat sort of software development opportunities are out there?  I'm
  1257. Xlooking for a change from the academic life.  I'm willing to relocate.
  1258. XI have familiarity with programming and system administration in a
  1259. XUNIX-based environment, know about configuration control, and have
  1260. Xtaught and am teaching courses in several areas including operating
  1261. Xsystems, programming languages, and software engineering.  More
  1262. Xinformation (and a formal resume listing degrees too numerous to
  1263. Xmention here) is available upon request.
  1264. X
  1265. XPeople here know I'm considering a change.
  1266. X
  1267. X                                       Rahul Dhesi
  1268. X                                       1988/09/12
  1269. END_OF_FILE
  1270. if test 716 -ne `wc -c <'readme.too'`; then
  1271.     echo shar: \"'readme.too'\" unpacked with wrong size!
  1272. fi
  1273. # end of 'readme.too'
  1274. fi
  1275. if test -f 'sysv.c' -a "${1}" != "-c" ; then 
  1276.   echo shar: Will not clobber existing file \"'sysv.c'\"
  1277. else
  1278. echo shar: Extracting \"'sysv.c'\" \(2570 characters\)
  1279. sed "s/^X//" >'sysv.c' <<'END_OF_FILE'
  1280. X#ifndef LINT
  1281. X/* @(#) sysv.c 2.5 88/01/10 14:47:24 */
  1282. Xstatic char sysvid[]="@(#) sysv.c 2.5 88/01/10 14:47:24";
  1283. X#endif /* LINT */
  1284. X
  1285. X/* machine.c for System V */
  1286. X
  1287. X/*
  1288. XThe contents of this file are hereby released to the public domain.
  1289. X
  1290. X                                    -- Rahul Dhesi  1986/12/31
  1291. X*/
  1292. X
  1293. X#ifdef UNBUF_IO
  1294. X/*
  1295. XFunction tell() returns the current seek position for a file 
  1296. Xdescriptor.  Microport System V/AT has an undocumented tell()
  1297. Xlibrary function (why?) but the UNIX PC doesn't, so we code
  1298. Xone here.  It is needed for unbuffered I/O only.
  1299. X*/
  1300. Xlong lseek PARMS ((int, long, int));
  1301. Xlong tell (fd)
  1302. Xint fd;
  1303. X{ return (lseek (fd, 0L, 1)); }
  1304. X#endif
  1305. X
  1306. X/****************
  1307. XDate and time functions are standard UNIX-style functions.  "nixtime.i"
  1308. Xwill be included by machine.c.
  1309. X*/
  1310. X
  1311. X#include <sys/types.h>
  1312. X#include <sys/stat.h>
  1313. X#include <time.h>
  1314. X
  1315. X/* Function isadir() returns 1 if the supplied handle is a directory, 
  1316. Xelse it returns 0.  
  1317. X*/
  1318. X
  1319. Xint isadir (file)
  1320. XZOOFILE file;
  1321. X{
  1322. X   int handle = fileno(file);
  1323. X   struct stat buf;           /* buffer to hold file information */
  1324. X   if (fstat (handle, &buf) == -1) {
  1325. X      return (0);             /* inaccessible -- assume not dir */
  1326. X   } else {
  1327. X      if (buf.st_mode & S_IFDIR)
  1328. X         return (1);
  1329. X      else
  1330. X         return (0);
  1331. X   }
  1332. X}
  1333. X
  1334. X/****************
  1335. XFunction fixfname() converts the supplied filename to a syntax
  1336. Xlegal for the host system.  It is used during extraction.
  1337. X*/
  1338. X
  1339. Xchar *fixfname(fname)
  1340. Xchar *fname;
  1341. X{
  1342. X   return (fname); /* default is no-op */
  1343. X}
  1344. X
  1345. Xextern long timezone;   /* defined by library routine */
  1346. Xlong time ();
  1347. Xstruct tm *localtime ();
  1348. X
  1349. X/* Function gettz(), returns the offset from GMT in seconds of the
  1350. Xlocal time, taking into account daylight savings time */
  1351. Xlong gettz()
  1352. X{
  1353. X    struct tm *tm;
  1354. X    long clock;
  1355. X    clock = time ((long *) 0);
  1356. X    tm = localtime (&clock);
  1357. X   return (timezone - tm->tm_isdst*3600);
  1358. X}
  1359. X
  1360. X/* Standard UNIX-compatible time functions */
  1361. X#include "nixtime.i"
  1362. X
  1363. X/* Standard UNIX-specific file attribute routines */
  1364. X#include "nixmode.i"
  1365. X
  1366. X/* 
  1367. XMake a directory.  System V has no system call accessible to 
  1368. Xordinary users to make a new directory.  Hence we spawn a shell 
  1369. Xand hope /bin/mkdir is there.  Since /bin/mkdir gives a nasty 
  1370. Xerror message if it fails, we call it only if nothing already 
  1371. Xexists by the name of the needed directory.
  1372. X*/
  1373. X
  1374. Xint mkdir(dirname)
  1375. Xchar *dirname;
  1376. X{
  1377. X   char cmd[PATHSIZE+11+1]; /* room for "/bin/mkdir " used below  + 1 spare */
  1378. X   if (!exists(dirname)) {
  1379. X      strcpy(cmd, "/bin/mkdir ");
  1380. X      strcat(cmd, dirname);
  1381. X      return (system(cmd));
  1382. X   }
  1383. X    return (0);
  1384. X}
  1385. END_OF_FILE
  1386. if test 2570 -ne `wc -c <'sysv.c'`; then
  1387.     echo shar: \"'sysv.c'\" unpacked with wrong size!
  1388. fi
  1389. # end of 'sysv.c'
  1390. fi
  1391. if test -f 'various.h' -a "${1}" != "-c" ; then 
  1392.   echo shar: Will not clobber existing file \"'various.h'\"
  1393. else
  1394. echo shar: Extracting \"'various.h'\" \(2447 characters\)
  1395. sed "s/^X//" >'various.h' <<'END_OF_FILE'
  1396. X/* @(#) various.h 2.3 87/12/27 14:44:34 */
  1397. X
  1398. X/*
  1399. XThe contents of this file are hereby released to the public domain.
  1400. X
  1401. X                           -- Rahul Dhesi 1986/11/14
  1402. X*/
  1403. X
  1404. X/*
  1405. XThis files gives definitions for most external functions used by Zoo.
  1406. XIf LINT_ARGS is defined, ANSI-style function prototypes are used, else
  1407. Xnormal K&R function declarations are used.
  1408. X
  1409. XNote:  Always precede this file with an include of stdio.h because it uses
  1410. Xthe predefined type FILE.
  1411. X
  1412. XMicrosoft C and Turbo C use different conventions for specifying an
  1413. Xincomplete argument list in a function prototype.  Microsoft C uses a
  1414. Xtrailing comma, while Turbo C uses three dots (...).  To take care
  1415. Xof these peculiarities, the symbol MORE stands for incomplete arguments.
  1416. XFor Turbo C we define it to be three dots and for Microsoft C we
  1417. Xdefine it to be nothing.  This is done in options.h, so options.h must
  1418. Xalways be included before various.h is included.
  1419. X*/
  1420. X
  1421. X#ifndef PARMS
  1422. X#ifdef LINT_ARGS
  1423. X#define    PARMS(x)        x
  1424. X#else
  1425. X#define    PARMS(x)        ()
  1426. X#endif
  1427. X#endif
  1428. X
  1429. XFILE *fdopen PARMS ((int, char *));
  1430. XFILE *fopen PARMS ((char *, char *));
  1431. Xchar *fgets PARMS ((char *, int, FILE *));
  1432. Xchar *gets PARMS ((char *));
  1433. Xchar *malloc PARMS ((unsigned int));
  1434. Xchar *realloc PARMS ((char *, unsigned int));
  1435. Xchar *strcat PARMS ((char *, char *));
  1436. Xchar *strchr PARMS ((char *, int));
  1437. Xchar *strcpy PARMS ((char *, char *));
  1438. Xchar *strdup PARMS ((char *));
  1439. Xchar *strlwr PARMS ((char *));
  1440. Xchar *strncat PARMS ((char *, char *, unsigned int));
  1441. Xchar *strncpy PARMS ((char *, char *, unsigned int));
  1442. Xchar *strrchr PARMS ((char *, int));
  1443. Xint fclose PARMS ((FILE *));
  1444. Xint fflush PARMS ((FILE *));
  1445. Xint fgetc PARMS ((FILE *));
  1446. Xint fgetchar PARMS (());
  1447. Xint fprintf PARMS ((FILE *, char *, MORE));
  1448. Xint fputchar PARMS ((int));
  1449. Xint fputs PARMS ((char *, FILE *));
  1450. X
  1451. X#ifdef ALWAYS_INT
  1452. Xint fputc PARMS ((int, FILE *));
  1453. Xint fread PARMS ((VOIDPTR, int, int, FILE *));
  1454. Xint fwrite PARMS ((VOIDPTR, int, int, FILE *));
  1455. X#else
  1456. Xint fputc PARMS ((char, FILE *));
  1457. Xint fread PARMS ((VOIDPTR, unsigned, unsigned, FILE *));
  1458. Xint fwrite PARMS ((VOIDPTR, unsigned, unsigned, FILE *));
  1459. X#endif /* ALWAYS_INT */
  1460. X
  1461. Xint fseek PARMS ((FILE *, long, int));
  1462. Xint printf PARMS ((char *, MORE));
  1463. Xint rename PARMS ((char *, char *));
  1464. Xint setmode PARMS ((int, int));
  1465. Xint strcmp PARMS ((char *, char *));
  1466. Xint strncmp PARMS ((char *, char *, unsigned int));
  1467. Xint unlink PARMS ((char *));
  1468. Xlong ftell PARMS ((FILE *));
  1469. Xunsigned int strlen PARMS ((char *));
  1470. END_OF_FILE
  1471. if test 2447 -ne `wc -c <'various.h'`; then
  1472.     echo shar: \"'various.h'\" unpacked with wrong size!
  1473. fi
  1474. # end of 'various.h'
  1475. fi
  1476. if test -f 'version.c' -a "${1}" != "-c" ; then 
  1477.   echo shar: Will not clobber existing file \"'version.c'\"
  1478. else
  1479. echo shar: Extracting \"'version.c'\" \(101 characters\)
  1480. sed "s/^X//" >'version.c' <<'END_OF_FILE'
  1481. X/* @(#) version.c 2.9 1988/08/25 12:43:57  */
  1482. Xchar version[] = "Version 2.01 (1988/08/25 12:43:57)";
  1483. END_OF_FILE
  1484. if test 101 -ne `wc -c <'version.c'`; then
  1485.     echo shar: \"'version.c'\" unpacked with wrong size!
  1486. fi
  1487. # end of 'version.c'
  1488. fi
  1489. if test -f 'zoofilt.c' -a "${1}" != "-c" ; then 
  1490.   echo shar: Will not clobber existing file \"'zoofilt.c'\"
  1491. else
  1492. echo shar: Extracting \"'zoofilt.c'\" \(1861 characters\)
  1493. sed "s/^X//" >'zoofilt.c' <<'END_OF_FILE'
  1494. X/* @(#) zoofilt.c 1.8 88/01/30 23:47:05 */
  1495. X
  1496. X#ifndef LINT
  1497. Xstatic char sccsid[]="@(#) zoofilt.c 1.8 88/01/30 23:47:05";
  1498. X#endif
  1499. X
  1500. X/*
  1501. X(C) Copyright 1988 Rahul Dhesi -- All rights reserved
  1502. X
  1503. XFilter mode -- compress or decompress standard input and write
  1504. Xto standard output.
  1505. X*/
  1506. X
  1507. X#include "options.h"
  1508. X
  1509. X#ifdef FILTER
  1510. X
  1511. X#include "zooio.h"
  1512. X#include "errors.i"
  1513. X
  1514. X/* action */
  1515. X#define COMPRESS        0
  1516. X#define UNCOMPRESS    1
  1517. X
  1518. X#define FTAG    ((unsigned int) 0x5a32)    /* magic number */
  1519. X
  1520. Xextern unsigned int crccode;
  1521. X
  1522. X#ifdef LINT_ARGS
  1523. Xint rdint(unsigned int *);    /* read an unsigned int */
  1524. Xint wrint(unsigned int);    /* write an unsigned int */
  1525. X#else
  1526. Xint rdint();
  1527. Xint wrint();
  1528. X#endif /* LINT_ARGS */
  1529. X
  1530. X/* global variable used to pass two bytes (CRC value) back from lzd to here */
  1531. Xunsigned int filt_lzd_word;
  1532. X
  1533. Xvoid zoofilt (option)
  1534. Xchar *option;
  1535. X{
  1536. X    int choice;                                            /* what to do -- [de]compress */
  1537. X    unsigned int filetag;                            /* tag stored in input */
  1538. X    int stat1, stat2, stat3;                        /* status codes */
  1539. X
  1540. X    switch (*++option) {
  1541. X        case 'c':    choice = COMPRESS;    break;
  1542. X        case 'u':    choice = UNCOMPRESS;  break;
  1543. X        default:
  1544. X         prterror ('f', inv_option, *option);    /* fatal error -- abort */
  1545. X    }
  1546. X
  1547. X    crccode = 0;    /* needed whether compressing or uncompressing */
  1548. X
  1549. X    switch (choice) {
  1550. X        case COMPRESS:
  1551. X            stat1 = wrint (FTAG);
  1552. X            stat2 = lzc (STDIN, STDOUT);
  1553. X            stat3 = wrint (crccode);
  1554. X            if (stat1 == 0 && stat2 == 0 && stat3 == 0)
  1555. X                zooexit (0);
  1556. X            else {
  1557. X                fprintf (stderr, "Zoo: FATAL: Compression error.\n");
  1558. X                zooexit (1);
  1559. X            }
  1560. X            break;
  1561. X        case UNCOMPRESS:
  1562. X            stat1 = rdint (&filetag);
  1563. X            if (stat1 != 0 || filetag != FTAG)
  1564. X                zooexit (1);
  1565. X            stat2 = lzd (STDIN, STDOUT);
  1566. X            if (stat2 == 0 && filt_lzd_word == crccode)
  1567. X                zooexit (0);
  1568. X            else {
  1569. X                fprintf (stderr, "Zoo: FATAL: Uncompression error.\n");
  1570. X                zooexit (1);
  1571. X            }
  1572. X            break;
  1573. X    }
  1574. X} /* zoofilt */
  1575. X
  1576. X#endif /* FILTER */
  1577. END_OF_FILE
  1578. if test 1861 -ne `wc -c <'zoofilt.c'`; then
  1579.     echo shar: \"'zoofilt.c'\" unpacked with wrong size!
  1580. fi
  1581. # end of 'zoofilt.c'
  1582. fi
  1583. echo shar: End of archive 1 \(of 10\).
  1584. cp /dev/null ark1isdone
  1585. MISSING=""
  1586. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  1587.     if test ! -f ark${I}isdone ; then
  1588.     MISSING="${MISSING} ${I}"
  1589.     fi
  1590. done
  1591. if test "${MISSING}" = "" ; then
  1592.     echo You have unpacked all 10 archives.
  1593.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1594. else
  1595.     echo You still need to unpack the following archives:
  1596.     echo "        " ${MISSING}
  1597. fi
  1598. ##  End of shell archive.
  1599. exit 0
  1600.